package utils

// 用于脱敏各种key,保留前后2个字符,eg: abcdefghijklmnopqrstuvwxyz -> ab****xyz
func DesensitizeKey(key string) string {
	return DesensitizeCommonKey(key, 3)
}

func DesensitizeCommonKey(key string, showNumber int) string {
	if len(key) >= showNumber {
		return key[:showNumber] + "****" + key[len(key)-showNumber:]
	}
	return key
}
